home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 151-175 / disk_170 / dis6502 / dis.h < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  98 lines

  1. #include <stdio.h>
  2.  
  3. #define NPREDEF 10
  4.  
  5. extern char *predef[];
  6. extern int  npredef;
  7. extern char *file;
  8. extern char *progname;
  9. extern int  bopt;
  10. #ifndef AMIGA
  11. extern unsigned char f[];
  12. extern unsigned char d[];
  13. #else
  14. extern unsigned char *d,*f;
  15. #endif
  16.  
  17. #define getword(x) (d[x] + (d[x+1] << 8))
  18. #define getbyte(x) (d[x])
  19.  
  20. /* f bits */
  21.  
  22. #define LOADED 1            /* Location loaded */
  23. #define JREF   2            /* Referenced as jump/branch dest */
  24. #define DREF   4            /* Referenced as data */
  25. #define SREF   8            /* Referenced as subroutine dest */
  26. #define NAMED  0x10            /* Has a name */
  27. #define TDONE  0x20            /* Has been traced */
  28. #define ISOP   0x40            /* Is a valid instruction opcode */
  29.  
  30. struct info {
  31.     char opn[4];
  32.     int  nb;
  33.     int  flag;
  34. };
  35.  
  36. extern struct info optbl[];
  37.  
  38. /* Flags */
  39.  
  40. /* Where control goes */
  41.  
  42. #define NORM 1
  43. #define JUMP 2
  44. #define FORK 4
  45. #define STOP 8
  46.  
  47. #define CTLMASK (NORM|JUMP|FORK|STOP)
  48.  
  49. /* Instruction format */
  50.  
  51. #define IMM  0x20
  52. #define ABS  0x40
  53. #define ACC  0x80
  54. #define IMP  0x100
  55. #define INX  0x200
  56. #define INY  0x400
  57. #define ZPX  0x800
  58. #define ABX  0x1000
  59. #define ABY  0x2000
  60. #define REL  0x4000
  61. #define IND  0x8000
  62. #define ZPY  0x10000
  63. #define ZPG  0x20000
  64. #define ILL  0x40000
  65.  
  66. #define ADRMASK (IMM|ABS|ACC|IMP|INX|INY|ZPX|ABX|ABY|REL|IND|ZPY|ZPG|ILL)
  67.  
  68. struct ref_chain {
  69.     struct ref_chain *next;
  70.     int who;
  71. };
  72.  
  73. struct ref_chain *get_ref();
  74. char *get_name();
  75.  
  76. /* lex junk */
  77.  
  78. #define EQ 256
  79. #define NUMBER 257
  80. #define NAME 258
  81. #define COMMENT 259
  82. #define LI 260
  83. #define TSTART 261
  84. #define TSTOP 262
  85.  
  86. extern FILE *yyin, *yyout;
  87. int lineno;
  88.  
  89. int yywrap(), yyerror();
  90. char *emalloc();
  91.  
  92. typedef union  {
  93.     int ival;
  94.     char *sval;
  95. } VALUE;
  96.  
  97. extern VALUE token;
  98.